<?php if (isset($winnersList) && $winnersList->num_rows() > 0) : ?>
<?php foreach ($winnersList->result() as $value) : ?>
    <?php
        $gradeClass = ''; //奖品样式不同
        switch ($value->grade) {
            case 1:
                $gradeClass = 'first';
                break;
            case 2:
                $gradeClass = 'two';
                break;
            case 3:
                $gradeClass = 'three';
                break;
            case 4:
                $gradeClass = 'four ';
                break;
            case 5:
                $gradeClass = 'five';
                break;
            case 6:
                $gradeClass = 'six';
                break;
            default:
                break;
        }
      ?>
    <li class="<?php echo $gradeClass; ?> already-award" data-id="<?php echo $value->id; ?>">
        <div class="li-header am-cf">
            <div class="li-tit">
                <i class="iconfont">&#xe66b;</i>
                <span><?php echo numberToZhUpper($value->grade), '等奖' ?></span>
            </div>
            <div class="li-right">
                <span>用户名：<?php echo substr($value->user_name, 0, 1), '***', substr($value->user_name, -1); ?></span>
            </div>
        </div>
        <div class="li-cont am-cf">
            <div class="li-info">
                <div class="prize-pic">
                    <img src="<?php echo $this->config->show_image_url($value->image); ?>" />
                </div>
                <div class="li-detail">
                    <p class="prize-name"><?php echo $value->prize_name; ?></p>
                    <p class="li-detail-bottom">中奖时间：<?php echo $value->created_at; ?></p>
                </div>
            </div>
            <div class="li-state">
                <?php switch ($value->status) {
                    case 1:
                        echo '待领奖';
                        break;
                    case 2:
                        echo '待颁奖';
                        break;
                    case 3:
                        echo '已颁发';
                        break;
                    default:
                        break;
                } ?>
            </div>
        </div>

        <div class="am-modal user-detail-modal user-detail-modal-shiwu" id="user-detail-modal-shiwu<?php echo $value->id; ?>">
            <div class="am-modal-dialog">
                <div class="am-modal-hd">中奖用户详情
                    <a href="javascript: void(0)" class="am-close iconfont" data-am-modal-close>&#xe62f;</a>
                </div>
                <div class="am-modal-bd">
                    <ul>
                        <li>
                            <p class="line_1">中奖者</p>
                            <p><?php echo $value->user_name; ?></p>
                        </li>
                        <li>
                            <p class="line_1">奖品类型</p>
                            <p>
                                <?php switch ($value->prize_type) {
                                    case 1:
                                        echo '实物';
                                        break;
                                    case 2:
                                        echo '虚拟物品';
                                        break;
                                    case 3:
                                        echo '积分';
                                        break;
                                    default:
                                        break;
                                } ?>
                            </p>
                        </li>
                        <li>
                        <p class="line_1">奖品名称</p>
                        <p><?php echo $value->prize_name; ?></p>
                        </li>
                        <li>
                            <p class="line_1">状态</p>
                            <p><?php 
                                switch ($value->status) {
                                    case 1:
                                        echo '待领奖';
                                         break;
                                    case 2:
                                        echo '待颁奖';
                                        break;
                                    case 3:
                                        echo '已颁发';
                                        break;
                                    default:
                                        break;
                                } ?>
                            </p>
                        </li>
                        <li>
                            <p class="line_1">奖品过期时间</p>
                            <p><?php echo $value->effective_date; ?></p>
                        </li>
                        <li>
                            <p class="line_1">中奖时间</p>
                            <p><?php echo $value->created_at; ?></p>
                        </li>
                    </ul>
                </div>

                <div class="am-modal-fd">
                    <?php if ($value->effective_date <= date('Y-m-d H:i:s')) : ?>
                        <p class="express-state"><span>奖品状态</span><b>已过期</b></p>
                    <?php elseif ($value->status == 1) : ?>
                        <p class="express-state"><span>奖品状态</span><b>待领奖</b></p>
                    <?php elseif ($value->status == 2) : ?>
                        <p class="express-state"><span>奖品状态：</span><b>待颁奖</b></p>
                    <?php elseif ($value->status == 3) : ?>
                        <p class="express-state"><span>奖品状态：</span><b>颁奖成功</b></p>
                    <?php endif; ?>

                    <?php if ( !empty($value->name) && $value->status ==3 && $value->prize_type == 1) : ?>
                        <p>物流：<?php echo $value->name; ?></p>
                        <p>运单号：<?php echo $value->number; ?></p>
                    <?php endif; ?>
                </div>
                <?php if ($value->status == 2 && $value->effective_date > date('Y-m-d H:i:s')) : ?>
                <div class="am-modal-fd am-modal-fd-status2" data-id="<?php echo $value->id; ?>">
                    <a href="javascript:;" class="am-btn">确认颁奖</a>
                </div>
                <?php endif; ?>
            </div>
        </div>

    </li>
<?php endforeach; ?>
<?php endif; ?>